home *** CD-ROM | disk | FTP | other *** search
/ Disc to the Future 2 / Disc to the Future Part II Programmer's Reference (Wayzata Technology)(6013)(1992).bin / MAC / THINKC / 5 / NETMOUSE / APOLOGIE. next >
Text File  |  1992-07-19  |  4KB  |  30 lines

  1. The original name for the receiver version of NetMouse was Mouse Slut.  The original name for the transmitter version was Kennedy.  This was because I found these names somewhat more humorous than Receiver and transmitter.  I hope that this won't offend anyone.  If they do, get a life.
  2.  
  3. The source code contains next to no documentation.  This, in fact, is about as good documentation as you're going to get.  Sorry.  If you had less than 48 hours to do a hack like this you won't take the time either.  Even now, I've got a product to ship in my real life, so I can't document this as well as it should be.
  4.  
  5. THE SOURCE CODE IS PUBLISHED ONLY BECAUSE OF PEOPLE'S CURIOSITY.  IT HAS BUGS, SOME SERIOUS.  IN PARTICULAR, SOME OF THE TECHNIQUES USED TO IMPLEMENT NETMOUSE ARE REALLY SKANKY, AND SHOULD BE AVOIDED.  THEY WILL PROBABLY BREAK IN FAIRLY SHORT ORDER, SAY, BY SYSTEM 7.2 OR SO.  Based on demand, I may work on a version which is a little less skanky, say by hooking into the ADB handlers.  For now, though, moving the mouse by slamming the low-mem mosue globals is something we all should avoid.
  6.  
  7. The source code contains a badly hacked C version of Paul Mercer's code for ShowINIT.  This version is pretty code at showing how to draw black and white, and color, icons, but it isn't necessarily the most compatible or latest version of ShowINIT, which would be the one posted on AppleLink in the developer section.  So, check there first to see if there's one later than the 1989 version.
  8.  
  9. Receiver functionality:
  10.  
  11. The PPC Toolbox doesn't work at INIT time.  So both the receiver and transmitter install a GNE filter which waits until Gestalt says PPC is around, and then install themselves.  Receiver then opens a PPC port, waits for a session to be started, and when one starts, waits to receive commands.
  12.  
  13. Commands are dispatched according to length.  A command block of length six means "move the mouse here, and make the mouse button this".  A command block with the same length as EventRecord says "this event just came through, fake it on your Mac."
  14.  
  15. The receiver once patched PostEvent and Button but these don't need to be anymore.  Believe it or not the receiver patches no traps except the GNE filter, and it only patches that because of the PPC problem.
  16.  
  17. Transmitter functionality:
  18.  
  19. The receiver pulls the same GNE trick to start up PPC.  Thing is, when it starts up, it has to pull up a PPCBrowser dialog first.  THis dialog allows you to pick any Mac on the netowrk to fake out.  Once selected, the transmitter attempts to attain guest program linking access and goes from there.
  20.  
  21. The transmitter operates in either a broadcast mode, where the mouse and keyboard are sent over to the receiver Mac, or the non-broadcast mode, where it doesn't do anything.  Actually, in either mode NetMouse watches the cursor to see if the screen needs to be changed.
  22.  
  23. If guest link access is attained, the Transmitter installs a VBL task.  The VBL Task sits around to watch the mouse, and if the mouse has moved, transmits the new information to the Receiver.  The PostEvent patch sits around to watch key downs and transmit them as necessary.  Rather than patching the event out, PostEvent lets it go through and on the way out, calls GetOSEvent to pull the event back out of the queue and broadcast it before it can be noticed.  This allows us to get all the proper modifier bits as part of the record without any real amount of extra work.
  24.  
  25. When NetMouse enters the broadcast phase, the mouse is hidden on the transmitter machine but it isn't decoupled; the mouse coordinates and position continue to be reflected in the low-memory globals if not the event queue.  The Button patch is there so that the transmitter machine doesn't start thinking its mouse is down just because the "remote" mouse is down; if NetMouse is in broadcast mode Button will always return false.
  26.  
  27. Further apologies for not making color startup icons, and again for the small length of this document.  I hope this code is of use to you, and I hope that someone who knows the problems with this method can fix this and do it right.  (If no one does, I'll do it, but I'm betting it'll be useful enough that other people will fix this stuff up before I get around to it.)
  28.                                                                                                           -jbx
  29.  
  30. ps Only 360 days until the next Hack contest!